﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using KeRui.Common;
using System.Collections.Generic;

public partial class Manage_Cms_VoteList : System.Web.UI.Page
{
    //基础
    public List<KeRui.Model.CmsVote> list;
    public int PageSize = 15;                               //每页数量
    public int PageIndex = PageRequest.GetInt("page", 1);   //请求的页码
    public int PageCS = PageRequest.GetInt("cs", -1);       //记录总数
    public int PageCount = 0;                               //总页数
    public string PageShow = "";
    public string SiteId = PageRequest.GetString("siteid");     
    protected void Page_Load(object sender, EventArgs e)
    {
        //如果传过来这个参数 证明开始删除数据
        if (Request.QueryString["DelVoteID"] != null)
        {
            DelVote(int.Parse(Request.QueryString["DelVoteID"].ToString()));
        }
        KeRui.BLL.CmsVote bllCmsVote = new KeRui.BLL.CmsVote();
        list = bllCmsVote.GetList(PageSize,PageIndex,SiteId);

        //总数
        if (PageCS == -1)
            PageCS = bllCmsVote.GetCount(SiteId);
        //总页数
        if (PageCS % PageSize == 0)
            PageCount = PageCS / PageSize;
        else
            PageCount = PageCS / PageSize + 1;
        //分页显示
        PageShow = ManageHelper.showSplitPage("VoteList.aspx?cs=" + PageCS.ToString() + "&page={0}&siteid=" + SiteId, PageIndex, PageSize, PageCS);
      
    }

    /// <summary>
    /// 删除的功能
    /// </summary>
    /// <param name="VoteID">主键ID 同时存储过程删除其余2表相关联的数据</param>
    private void DelVote(int VoteID)
    {
        KeRui.BLL.CmsVote bllCmsVote = new KeRui.BLL.CmsVote();
        bllCmsVote.Delete(VoteID);
    }
}
